﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0014)about:internet -->
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:mssdk="winsdk" xmlns:script="urn:script" xmlns:build="urn:build" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="Description" content="You can use Microsoft Visual Studio to set up and perform kernel-mode debugging over a null-modem cable. Null-modem cables are serial cables that have been configured to send data between two serial ports."/>
<meta name="MSHAttr" content="PreferredSiteName:MSDN"/>
<meta name="MSHAttr" content="PreferredLib:/library/windows/hardware"/>
<title>Setting Up Kernel-Mode Debugging over a Serial Cable in Visual Studio</title>



<link rel="STYLESHEET" type="text/css" HREF="../common/backsdk4.css"/>





<style>
html,div { margin: 0; padding: 0;}

body {
	padding: 0px;
	margin: 0px;
	overflow: auto;
	height: 100%;
}

#winchm_template_button{
	float: right;
	width: 93px;
	top: 7px;
	position: relative;
	text-align: right;
	right: 5px;
	height: auto;
}

#winchm_template_top{
	padding: 0px;
	margin: 0px;
	border-bottom: 1px solid #9B9B9B;
	background-color: #B1CEFE;
}

#winchm_template_navigation{
	margin: 0px;
	padding-top: 7px;
	padding-left: 7px;
	padding-bottom: 3px;
	padding-right: 0px;
	font-size: 8.5pt;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: normal;
	color: #585858;
}

#winchm_template_title{
	margin: 0px;
	padding-top: 4px;
	padding-left: 7px;
	padding-bottom: 7px;
	padding-right: 0px;
	font-size: 18px; 
	font-family: Verdana, Geneva, sans-serif;
	color: #363636;
}

#winchm_template_content{
	margin-top: 20px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	width: auto  !important;
	width: 100%;
}

#winchm_template_footer{
	border-width: 1px;
	border-color: #B1CEFE;
	border-top-style: solid;
	margin-top: 15px;
	margin-left: 15px;
	margin-bottom: 20px;
	margin-right: 15px;
	padding-top: 7px;
	padding-left: 0px;
	padding-bottom: 0px;
	padding-right: 0px;
	font-family: arial, helvetica, sans-serif;
	font-size: 8.5pt;
	color: #696969;
	width: auto;
	text-align: left;
}


#winchm_template_container{
	margin: 0px;
	padding: 0px;
	position: static;
	padding-bottom: 3px;
	overflow: auto;
	background-color: #FFFFFF;
}


@media print
{
#winchm_template_container{
	position: static;	
	margin: 0px;
	padding: 5px;
	
	width: auto;
	height: auto;
	overflow: auto;
}
#winchm_template_button{
visibility:hidden;
}
}

#winchm_template_navigation A:link	{text-decoration: none; color:#004080}
#winchm_template_navigation A:visited  {text-decoration: none; color: #004080}
#winchm_template_navigation A:active {text-decoration: none; color: #004080 }
#winchm_template_navigation A:hover {text-decoration: none;color: #0080FF}

A:link	{text-decoration: underline; color:#0033CC}
A:visited  {text-decoration: underline; color: #0033CC}
A:active {text-decoration: underline; color: #0033CC }
A:hover {text-decoration: underline;color: #FF0000;}
</style>
<script type="text/javascript">
function isMobile(){
Agent = window.navigator.userAgent;
if (Agent.indexOf("iPhone")>=1 || Agent.indexOf("iPad")>=1 || Agent.indexOf("iPod")>=1 || Agent.indexOf("Android")>=1){
return true;
}else{
return false;	
}

}
function d_onresize(){
if (window.navigator.userAgent.indexOf("MSIE")>=1){
document.getElementById('winchm_template_container').style.pixelWidth = document.body.offsetWidth - 3;
document.getElementById('winchm_template_container').style.pixelHeight = document.body.offsetHeight - document.getElementById('winchm_template_top').offsetHeight - 4;
}
document.getElementById('winchm_template_container').style.top = document.getElementById('winchm_template_top').offsetHeight + 'px';
}

function d_onbeforeprint(){
document.getElementById('winchm_template_container').style.width = 'auto';
document.getElementById('winchm_template_container').style.height = 'auto';
}

function d_onafterprint(){
d_onresize();
}

if(!isMobile()){

window.onload = d_onresize;
window.onresize = d_onresize;
window.onbeforeprint = d_onbeforeprint;
window.onafterprint = d_onafterprint;

document.write("<style>\n");
document.write("body {overflow: hidden;}\n");
document.write("#winchm_template_container {position: absolute;overflow: auto;top : 0px;right: 0px;bottom: 0px;left: 0px;}\n");
document.write("</style>\n");
}

</script>
</head>
<body><script language="JavaScript" type="text/JavaScript">
function syn(){
if(parent.nav.tree){
 if(parent.nav.tree.loaded){
  parent.nav.tree.selectNode(12);
 }else{
  setTimeout("syn()",500);
}
  }else{
  setTimeout("syn()",500);
  }}
if(parent!=self){
  setTimeout("syn()",100);
}else{
  parent.location.href = "../../index.htm?page=debugger/setting_up_a_null-modem_cable_connection_in_visual_studio.htm";
}
originalOnload = window.onload;
if(originalOnload==null){
window.onload = function(){parent.contentLoaded = true;};
}else{
window.onload = function(){originalOnload();parent.contentLoaded = true;};
}
</script> 


<div id="winchm_template_top">
	<div id="winchm_template_button"><A href="setting_up_a_usb_2_0_cable_connection_in_visual_studio.htm" title="Previous topic"><img id="winchm_template_prev" alt="Previous topic" src="../template2/btn_prev_n.gif" border="0"></a><A href="setting_up_kernel-mode_debugging_using_serial_over_usb_in_visual_studio.htm" title="Next topic"><img id="winchm_template_next" alt="Next topic" src="../template2/btn_next_n.gif" border="0"></a></div>
	<div id="winchm_template_navigation">Help &gt; 
<A href="introduction6.htm">Debugging Tools for Windows (WinDbg, KD, CDB, NTSD)</A> &gt; <A href="getting_started_with_windows_debugging.htm">Getting Started with Windows Debugging</A> &gt; <A href="getting_set_up_for_debugging.htm">Setting Up Debugging (Kernel-Mode and User-Mode)</A> &gt; <A href="setting_up_kernel-mode_debugging_in_visual_studio.htm">Setting Up Kernel-Mode Debugging in Visual Studio</A> &gt; </div>
	<div id="winchm_template_title">Setting Up Kernel-Mode Debugging over a Serial Cable in Visual Studio</div>
</div>
<div id="winchm_template_container">
	<div id="winchm_template_content"><div id="mainSection"><p>You can use Microsoft Visual Studio to set up and perform kernel-mode debugging over a null-modem cable. Null-modem cables are serial cables that have been configured to send data between two serial ports. They are available at most computer stores. Do not confuse null-modem cables with standard serial cables. Standard serial cables do not connect serial ports to each other. For information about how null-modem cables are wired, see <a href="#Bookmark12">Null-Modem Cable Wiring</a>.</p>
<p>To use Visual Studio for kernel-mode debugging, you must have the Windows Driver Kit (WDK) integrated with Visual Studio. For information about how to install the integrated environment, see <a href="http://go.microsoft.com/fwlink/p?linkid=301383">Windows Driver Development</a>.</p>
<p>As an alternative to using Visual Studio to set up serial debugging, you can do the setup manually. For more information, see <a href="#Bookmark20">Setting Up Kernel-Mode Debugging over a Serial Cable Manually</a>.</p>
<p>The computer that runs the debugger is called the <i>host computer</i>, and the computer being debugged is called the <i>target computer</i>.</p>
<h2><a id="Configuring_the_host_and_target_computers"></a><a id="configuring_the_host_and_target_computers"></a><a id="CONFIGURING_THE_HOST_AND_TARGET_COMPUTERS"></a>Configuring the host and target computers</h2>
<ol>
<li>Begin configuring your host and target computer as described in Provision a computer for driver deployment and testing (WDK 8.1).</li>
<li>On the host computer, in  Visual Studio, when you come to the Computer Configuration dialog box, select <b>Provision computer and choose debugger settings</b>.</li>
<li>
<p>For <b>Connection Type</b>, choose <b>Serial</b>.</p><img src="images/SetupSerialVs.png" alt="Screen shot showing an example of debugger settings with values for the following fields: Connection Type, Target Name, and Bus Parameters"/><p>For <b>Baud Rate</b>, accept the default value or enter the baud rate you want to use. For <b>Port</b>, enter the name of the COM port that you want to use for debugging on the host computer. For <b>Target Port</b>, enter the name of the COM port that you want to use for debugging on the target computer.</p>
</li>
<li>The configuration process takes several minutes and might automatically reboot the target computer once or twice. When the process is complete, click <b>Finish</b>.</li>
</ol>
<h2><a id="Starting_the_Debugging_Session"></a><a id="starting_the_debugging_session"></a><a id="STARTING_THE_DEBUGGING_SESSION"></a>Starting the Debugging Session</h2>
<ol>
<li>Connect the null-modem cable to the COM ports that you have chosen for debugging on the host and target computers.</li>
<li>On the host computer, in Visual Studio, on the <b>Tools</b> menu, choose <b>Attach to Process</b>.</li>
<li>For <b>Transport</b>, choose <b>Windows Kernel Mode Debugger</b>.</li>
<li>For <b>Qualifier</b>, select the name of the target computer that you previously configured.</li>
<li>Click <b>Attach</b>.</li>
</ol>
<h2><a id="Troubleshooting_Tips_for_Debugging_over_a_Serial_Cable"></a><a id="troubleshooting_tips_for_debugging_over_a_serial_cable"></a><a id="TROUBLESHOOTING_TIPS_FOR_DEBUGGING_OVER_A_SERIAL_CABLE"></a>Troubleshooting Tips for Debugging over a Serial Cable</h2>
<h3><a id="Specify_correct_COM_ports_and_baud_rate"></a><a id="specify_correct_com_ports_and_baud_rate"></a><a id="SPECIFY_CORRECT_COM_PORTS_AND_BAUD_RATE"></a>Specify correct COM ports and baud rate</h3>
<p>Determine the numbers of the COM ports you are using for debugging on the host and target computers. For example, suppose you have your null-modem cable connected to COM1 on the host computer and COM2 on the target computer. Also suppose you have chosen a baud rate of 115200.</p>
<ol>
<li>On the host computer, in Visual Studio, on the <b>Driver</b> menu, choose <b>Test &gt; Configure Computers</b>.</li>
<li>Select the name of your test computer, and click <b>Next</b>.</li>
<li>Select <b>Provision computer and choose debugger settings</b>. Click <b>Next</b>.</li>
<li>If you are using COM1 on the host computer, for <b>Port</b>, enter com1. If you are using COM2 on the target computer, for <b>Target Port</b>, enter com2. </li>
<li>If you have chosen to use a baud rate of 115200, for <b>Baud Rate</b>, enter 115200.</li>
</ol>
<p>You can double check the COM port and baud rate settings on the target computer by opening a Command Prompt window as Administrator, and entering <b>bcdedit /dbgsettings</b>. If you are using COM2 on the target computer and a baud rate of 115200, the output of <b>bcdedit</b> should show <code>debugport 2</code> and <code>baudrate 115200</code>.</p>
<h2><a id="null_modem_cable_wiring"></a><a id="NULL_MODEM_CABLE_WIRING"></a>Null Modem Cable Wiring</h2>
<p>The following tables show how null-modem cables are wired.</p>
<h3><a id="9-pin_connector"></a><a id="9-PIN_CONNECTOR"></a>9-pin connector</h3>
<table>
<tr>
<th>Connector 1</th>
<th>Connector 2</th>
<th>Signals</th>
</tr>
<tr>
<td>2</td>
<td>3</td>
<td>Tx - Rx</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>Rx - Tx</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>RTS - CTS</td>
</tr>
<tr>
<td>8</td>
<td>7</td>
<td>CTS - RTS</td>
</tr>
<tr>
<td>4</td>
<td>1+6</td>
<td>DTR - (CD+DSR)</td>
</tr>
<tr>
<td>1+6</td>
<td>4</td>
<td>(CD+DSR) - DTR</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
<td>Signal ground</td>
</tr>
</table>
<p> </p>
<h3><a id="25-pin_connector"></a><a id="25-PIN_CONNECTOR"></a>25-pin connector</h3>
<table>
<tr>
<th>Connector 1</th>
<th>Connector 2</th>
<th>Signals</th>
</tr>
<tr>
<td>2</td>
<td>3</td>
<td>Tx - Rx</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>Rx - Tx</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>RTS - CTS</td>
</tr>
<tr>
<td>5</td>
<td>4</td>
<td>CTS - RTS</td>
</tr>
<tr>
<td>6</td>
<td>20</td>
<td>DSR - DTR</td>
</tr>
<tr>
<td>20</td>
<td>6</td>
<td>DTR - DSR</td>
</tr>
<tr>
<td>7</td>
<td>7</td>
<td>Signal ground</td>
</tr>
</table>
<p> </p>
<h3><a id="Signal_Abbreviations"></a><a id="signal_abbreviations"></a><a id="SIGNAL_ABBREVIATIONS"></a>Signal Abbreviations</h3>
<table>
<tr>
<th>Abbreviation</th>
<th>Signal</th>
</tr>
<tr>
<td>Tx</td>
<td>Transmit data</td>
</tr>
<tr>
<td>Rx</td>
<td>Receive data</td>
</tr>
<tr>
<td>RTS</td>
<td>Request to send</td>
</tr>
<tr>
<td>CTS</td>
<td>Clear to send</td>
</tr>
<tr>
<td>DTR</td>
<td>Data terminal ready</td>
</tr>
<tr>
<td>DSR</td>
<td>Data set ready</td>
</tr>
<tr>
<td>CD</td>
<td>Carrier detect</td>
</tr>
</table>
<p> </p>
<h2><a id="related_topics"></a>Related topics</h2>
<dl>
<dt><a href="#Bookmark7">Setting Up Kernel-Mode Debugging in Visual Studio</a></dt></dl></div></div>	
	<div id="winchm_template_footer">Copyright &copy; 2019. All rights 
reserved. (To change the copyright info, just edit it in template.)</div>
</div>

</body>
</html>
